package QAInfo::Controller::Reports;

use strict;
use warnings;
use base 'Catalyst::Controller';

=head1 NAME

QAInfo::Controller::Reports - Catalyst Controller

=head1 DESCRIPTION

Catalyst Controller.

=head1 METHODS

=cut


=head2 index 

=cut

sub index : Private {
    my ( $self, $c ) = @_;

    $c->response->body('Matched QAInfo::Controller::Reports in Reports.');
}

=head2 display 

=cut

sub display : Local {
    my ( $self, $c ) = @_;
    $c->stash->{template} = 'Reports/display.tt2';
    my $reports_rs = $c->model("InfoDB::Reports");

    my $page = $c->request->param('page');
    $page = 1 unless $page;
    my $rows = $c->config->{'InfoDB::Reports'}->{'rows_per_page'} or 50;


    my $reports = $reports_rs->search({}, { page => $page, rows => 100 } );
    my $pager = $reports->pager;

    $c->stash->{'reports'} = $reports;
    $c->stash->{'pager'}   = $pager;
}

=head2 display 

=cut

sub tree : Local {
    my ( $self, $c ) = @_;
    $c->stash->{template} = 'Reports/tree.tt2';
    my $testplans_rs = $c->model("InfoDB::Testplans");
    $c->stash->{testplans} = $testplans_rs; 
}

=head2 display 

=cut

sub calendar : Local {
    my ( $self, $c ) = @_;
    $c->stash->{template} = 'Reports/calendar.tt2';
}

=head1 AUTHOR

A clever guy

=head1 LICENSE

This library is free software, you can redistribute it and/or modify
it under the same terms as Perl itself.

=cut

1;
